﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace EFModel.Migrations
{
    public partial class lo : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "major_change",
                columns: table => new
                {
                    mch_id = table.Column<int>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    first_kind_id = table.Column<int>(nullable: false),
                    first_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    second_kind_id = table.Column<int>(nullable: false),
                    second_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    third_kind_id = table.Column<int>(nullable: false),
                    third_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    major_kind_id = table.Column<int>(nullable: false),
                    major_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    major_id = table.Column<int>(nullable: false),
                    major_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_first_kind_id = table.Column<int>(nullable: false),
                    new_first_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_second_kind_id = table.Column<int>(nullable: false),
                    new_second_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_third_kind_id = table.Column<int>(nullable: false),
                    new_third_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_major_kind_id = table.Column<int>(nullable: false),
                    new_major_kind_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_major_id = table.Column<int>(nullable: false),
                    new_major_name = table.Column<string>(maxLength: 300, nullable: true),
                    human_id = table.Column<int>(nullable: false),
                    human_name = table.Column<string>(maxLength: 300, nullable: true),
                    salary_standard_id = table.Column<int>(nullable: false),
                    salary_standard_name = table.Column<string>(maxLength: 300, nullable: true),
                    salary_sum = table.Column<double>(nullable: false),
                    new_salary_standard_id = table.Column<int>(nullable: false),
                    new_salary_standard_name = table.Column<string>(maxLength: 300, nullable: true),
                    new_salary_sum = table.Column<double>(nullable: false),
                    change_reason = table.Column<string>(maxLength: 300, nullable: true),
                    check_reason = table.Column<string>(maxLength: 300, nullable: true),
                    check_status = table.Column<int>(nullable: false),
                    register = table.Column<string>(maxLength: 300, nullable: true),
                    checker = table.Column<string>(maxLength: 300, nullable: true),
                    regist_time = table.Column<DateTime>(nullable: false),
                    check_time = table.Column<DateTime>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_major_change", x => x.mch_id);
                    table.ForeignKey(
                        name: "FK_major_change_human_file_human_id",
                        column: x => x.human_id,
                        principalTable: "human_file",
                        principalColumn: "huf_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_config_file_first_kind_new_first_kind_id",
                        column: x => x.new_first_kind_id,
                        principalTable: "config_file_first_kind",
                        principalColumn: "ffk_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_config_major_new_major_id",
                        column: x => x.new_major_id,
                        principalTable: "config_major",
                        principalColumn: "mak_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_config_major_kind_new_major_kind_id",
                        column: x => x.new_major_kind_id,
                        principalTable: "config_major_kind",
                        principalColumn: "mfk_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_salary_standard_new_salary_standard_id",
                        column: x => x.new_salary_standard_id,
                        principalTable: "salary_standard",
                        principalColumn: "ssd_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_config_file_second_kind_new_second_kind_id",
                        column: x => x.new_second_kind_id,
                        principalTable: "config_file_second_kind",
                        principalColumn: "fsk_id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_major_change_config_file_third_kind_new_third_kind_id",
                        column: x => x.new_third_kind_id,
                        principalTable: "config_file_third_kind",
                        principalColumn: "ftk_id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateIndex(
                name: "IX_major_change_human_id",
                table: "major_change",
                column: "human_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_first_kind_id",
                table: "major_change",
                column: "new_first_kind_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_major_id",
                table: "major_change",
                column: "new_major_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_major_kind_id",
                table: "major_change",
                column: "new_major_kind_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_salary_standard_id",
                table: "major_change",
                column: "new_salary_standard_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_second_kind_id",
                table: "major_change",
                column: "new_second_kind_id");

            migrationBuilder.CreateIndex(
                name: "IX_major_change_new_third_kind_id",
                table: "major_change",
                column: "new_third_kind_id");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "major_change");
        }
    }
}
